﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;

namespace Snake.Client
{
    public class Controls
    {
        private readonly SortedList<Keys, SnakeEvent> _controls;

        public Controls()
        {
            _controls = new SortedList<Keys, SnakeEvent>();
        }

        public void Bind(Keys key, SnakeEvent snakeEvent)
        {
            _controls.Add(key, snakeEvent);
        }
        public SnakeEvent ParseKey(Keys[] keys)
        {
            foreach (var key in keys)
            {
                if (_controls.ContainsKey(key))
                {
                    return _controls[key];
                }
            }
            return SnakeEvent.NoAction;
        }
    }
}
